package com.ellecity06.common.ktx

import android.app.Activity
import android.content.Context
import androidx.fragment.app.Fragment

/**
 * @author ellecity06
 * @time 2023/4/15 11:07
 * @des
 */

inline fun <reified T : Activity> Context.launchActivity(vararg params: Pair<String, Any?>) {
    Internals.internalStartActivity(this, T::class.java, params)
}
inline fun <reified T : Activity> Activity.launchActivity(vararg params: Pair<String, Any?>) {
    Internals.internalStartActivity(this, T::class.java, params)
}
inline fun <reified T : Activity> Fragment.launchActivity(vararg params: Pair<String, Any?>) {
    Internals.internalStartActivity(requireActivity(), T::class.java, params)
}

inline fun <reified T : Activity> Activity.launchActivityForResult(requestCode: Int, vararg params: Pair<String, Any?>) =
    Internals.internalStartActivityForResult(this, T::class.java, requestCode, params)

inline fun <reified T : Activity> Fragment.launchActivityForResult(requestCode: Int, vararg params: Pair<String, Any?>) =
   startActivityForResult(Internals.createIntent(requireActivity(),  T::class.java, params),requestCode)



